package com.animation_study.mpandroidchart.fragment;

import android.graphics.Color;

import com.animation_study.R;
import com.github.mikephil.charting.charts.RadarChart;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.RadarData;
import com.github.mikephil.charting.data.RadarDataSet;

import java.util.ArrayList;

/**
 * Created by css on 2017/12/25.
 */

public class RadarFragment extends BaseFragment {
    private RadarChart radarChart;
    private ArrayList<String> lable;
    private ArrayList<Entry> entries;

    @Override
    public int getLayout() {
        return R.layout.fragment_radar;
    }

    @Override
    protected void initView() {
        lable = new ArrayList<>();
        entries = new ArrayList<>();
        for (int i = 1; i <= 6; i++) {
            lable.add(i + "次");
            entries.add(new Entry((float) (Math.random() * 100), i));
        }
        radarChart = rootView.findViewById(R.id.radarChart);
        RadarDataSet radarDataSet = new RadarDataSet(entries, "雷达图学习");
        radarDataSet.setColor(Color.RED);
        RadarData radarData = new RadarData(lable, radarDataSet);
        radarChart.setData(radarData);
    }
}
